package com.wordlearning.app.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.time.LocalDateTime;
import java.time.LocalDate;

@Data
@TableName("study_plans")
public class StudyPlan {

    @TableId(type = IdType.AUTO)
    private Long id;

    @TableField(insertStrategy = FieldStrategy.NOT_NULL)
    private String name;

    @TableField(value = "user_id", insertStrategy = FieldStrategy.NOT_NULL, fill = FieldFill.INSERT)
    private Long userId = 1L; // 默认用户ID

    @TableField("word_set_id")
    private Long wordSetId; // 改为外键ID字段，不再使用对象关联

    @TableField(value = "daily_target", insertStrategy = FieldStrategy.NOT_NULL)
    private Integer dailyTarget = 10;

    @TableField(value = "start_date", insertStrategy = FieldStrategy.NOT_NULL)
    private LocalDate startDate;

    @TableField("end_date")
    private LocalDate endDate;

    @TableField(value = "completed_count", insertStrategy = FieldStrategy.NOT_NULL)
    private Integer completedCount = 0;

    @TableField(insertStrategy = FieldStrategy.NOT_NULL)
    private String status = "ACTIVE";

    @TableField(value = "created_at", fill = FieldFill.INSERT)
    private LocalDateTime createdAt;

    @TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedAt;

    // 移除JPA的生命周期回调，使用MyBatis-Plus的自动填充功能
    // 自动填充功能需要配置MetaObjectHandler实现类

    // 移除JPA的生命周期回调，使用MyBatis-Plus的自动填充功能
}